package work20241223;

/**
 * @author zdl
 * @date 2024/12/23
 */
public class Demo4 {
    public static void main(String[] args) {
        Thread thread1 = new Thread("线程1:") {
            @Override
            public void run() {
                for (int i = 1; i < 100; i++) {
                    System.out.println(this.getName() + "-------------->" + i);
                }
            }
        };
        Thread thread2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName() + "------------------->" + i);
                }
            }
        }, "守护线程2:");
        thread2.setDaemon(true);
        thread1.start();
        thread2.start();
    }
}
